package com.example.roundprogressbardemo.slice;

import com.example.roundprogressbardemo.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.RoundProgressBar;
import ohos.agp.utils.Color;

public class MainAbilitySlice extends AbilitySlice {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);

        // 获取组件实例对象
        RoundProgressBar roundProgressBar = (RoundProgressBar) findComponentById(ResourceTable.Id_round_progress_bar);
        // 设置最大进度值
        roundProgressBar.setMaxValue(360);
        // 设置最小进度值
        roundProgressBar.setMinValue(0);
        // 设置最大角度
        roundProgressBar.setMaxAngle(360);
        // 设置起始角度
        roundProgressBar.setStartAngle(0);
        // 设置当前进度值
        roundProgressBar.setProgressValue(210);
        // 设置提示文案
        roundProgressBar.setProgressHintText("210°");
        // 设置提示文案颜色
        roundProgressBar.setProgressHintTextColor(Color.RED);
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
